package com.xh.baselibrary.tts;

import java.util.Objects;
import java.util.concurrent.LinkedBlockingDeque;

/**
 * Created by Mr.X on 2017/2/10.
 */

public class TTSResponse {
    //生成的结果数组
    public LinkedBlockingDeque<ResponseData> pcmDeque = new LinkedBlockingDeque<>();
    private final String uuID;

    public TTSResponse(String uuID) {
        this.uuID = uuID;
    }

    public String getUUID() {
        return uuID;
    }

    public void appendResponseData(ResponseData responseData) {
        pcmDeque.add(responseData);
    }

    public String tag;
    public String getTag(){
        return tag;
    }
    public Long getTimeID(){
        return 0L;
    }
    @Override
    public String toString() {
        return "TTSResponse{" +
                ", uuID='" + uuID + '\'' +
                '}';
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TTSResponse that = (TTSResponse) o;
        return Objects.equals(uuID, that.uuID);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uuID);
    }

    public int getNumSamples() {
        return 0;
    }

    public static class ResponseData {
        byte[] bytes;
        boolean isFinish = false;
        private int currPos = 0;

        ResponseData(byte[] bytes) {
            this.bytes = bytes;
        }

        public ResponseData() {

        }
        public int getCurrPos() {
            return currPos;
        }
        public void setCurrPos(int pos) {
            currPos = pos;
        }

        public void setBytes(byte[] bytes) {
            this.bytes = bytes;
        }

        public boolean isFinish() {
            return isFinish;
        }

        public void setFinish(boolean finish) {
            isFinish = finish;
        }

        public byte[] getBytes() {
            return bytes;
        }
    }
}
